#include <stdio.h>
#include <stdlib.h>
#include "Master/client/master_client.h"
#include "coid/comm/binstream/stdstream.h"
#include "coid/comm/binstream/binstream.h"

using namespace coid;


int main(int argc, char *argv[])
{
   coid::stdoutstream __s;    
   CMaster_client *masterThread;

   __s << "Connecting to coid server ... ";
   masterThread = new CMaster_client;
   printf("connecting\n");
     // send the configuration data to the main object by configuration event
     // it will start the configuration process, and the main object will configure
     // the SR and MG objects, and every object will be ready for test
   opcd e = masterThread->connect(master_address_1);
   __s << opcd_formatter(e) << BINSTREAM_FLUSH;
   printf("connected\n");
   e = masterThread->insertMasterMessage(1);
   __s << opcd_formatter(e) << BINSTREAM_FLUSH;
   printf("message inserted\n");
   sleep(5);
   e = masterThread->insertMasterMessage(2);
   __s << opcd_formatter(e) << BINSTREAM_FLUSH;
   printf("message inserted\n");
   delete masterThread;
   return 0;
}
